local key = KEYS[1]
local memberScore = ARGV
local sizeLimit = 100

if redis.call("EXISTS", key) == 0 then
    return -1
end

local currentSize = redis.call("ZCARD", key)

for i = 1, #memberScore, 2 do
    local member = memberScore[i]
    local score = memberScore[i+1]
    if currentSize > sizeLimit then
        break
    else
        redis.call("ZADD", key, score, member)
        currentSize = currentSize + 1
    end
end

return 0